var pathname = window.document.location.pathname;
function linkPjax(url,addEntry) {
    // $(".pjax-container").removeClass("active");
    // $("#"+id).addClass("active");

    $.ajax({
        type: "post",
        url: url,
        success:function (data) {
            console.log(data);
            $(".pjax-container").html(data);
        }
    });

    var state = new Object();
    if(addEntry == true){
        history.pushState(state,null,url);
    }


}

window.addEventListener("popstate",function(e){
    if(location.pathname!=pathname){
        linkPjax(location.pathname,false);
    }else{
        $(".pjax-container").html("");
        // $(".pjax-container").removeClass("active");
    }
},false);

$(document).ready(function () {
    $(document).bind("keydown",function (e) {
        e = window.event || e;
        if(e.keyCode == 116){
            alert("页面禁止刷新");
            e.keyCode = 0;
            return false;
        }
    })
});